// 封装自己的微信小程序的异步请求
export default (params)=>{
  // 加载中
  wx.showLoading({
    title:'加载中'
  })

  // const user_id = wx.getStorageSync('userInfo')

  return new Promise((resolve,reject)=>{
    wx.request({
      ...params,
      header: {
        "content-type": "application/json",
        "XX-applets-AppId": "wx4be1582aa5b3b85f",
        "XX-Device-Type": "wxapplets",
        "XX-Api-Version": "1.0.0",
        "Authorization": "Bearer " + wx.getStorageSync('session_key')
      },
      success(res){
        resolve(res.data)
      },
      fail(err){
        reject(err)
      },
      complete(){
        wx.hideLoading()
      }
    })
  })
}